package com.lecture.java8.io;

import java.io.*;

/**
 * @author luyn
 * @version 1.0
 * @description
 * @date 2021/1/18 10:51
 */
public class FileInputStreamTest {
    public static void main(String[] args) throws Exception {
        File file = new File("E:\\ZN\\1.txt");
        File file1 = new File("E:\\ZN\\1_2.txt");

        InputStream inputStream = new FileInputStream(file);
        OutputStream outputStream = new FileOutputStream(file1);

        int len;
        byte[] buff = new byte[7];
        while ((len = inputStream.read(buff)) != -1) {
            String str = new String(buff, 0, len);
            System.out.print(str);
            outputStream.write(buff, 0, len);
        }

        inputStream.close();
        outputStream.close();
    }
}
